package com.yhao.controller;

import com.yhao.Dao.LoginRepository;
import com.yhao.bean.base.BaseResult;
import com.yhao.bean.login.LoginBean;
import com.yhao.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2017/10/23.
 */
@RestController
public class LoginController {

    @Autowired
    LoginService loginService;

    @PostMapping(name = "/login")
    public BaseResult login(@RequestParam(name = "userName") String userName, @RequestParam(name = "password") String password) {

        return loginService.login(userName, password);
    }


    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    @Autowired
    private LoginRepository loginRepository;

    @GetMapping("/aa")
    public LoginBean aa() {
        LoginBean name = loginRepository.findByUserName("aaa");
        return name;
    }


}
